#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  if (m > (n + 1)) {
    printf("NO\n");
    return 0;
  }
  if (m == (n + 1)) {
    putchar('1');
    while (--m) {
      putchar('0');
      putchar('1');
    }
    putchar('\n');
    return 0;
  }
  int nz = n - m;
  while (m--) {
    putchar('0');
    putchar('1');
  }
  while (nz--) {
    putchar('0');
  }
  putchar('\n');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jle    117c <main+0x4c>
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1247 <main+0x117>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    11d8 <main+0xa8>
mov    $0x31,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
je     11c2 <main+0x92>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    $0x31,%edi
call   1030 <putchar@plt>
jmp    1197 <main+0x67>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x4(%rbp)
jmp    1247 <main+0x117>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     120e <main+0xde>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    $0x31,%edi
call   1030 <putchar@plt>
jmp    11e1 <main+0xb1>
jmp    1213 <main+0xe3>
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x10(%rbp)
cmp    $0x0,%eax
je     1236 <main+0x106>
mov    $0x30,%edi
call   1030 <putchar@plt>
jmp    1213 <main+0xe3>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1050 <scanf@plt>
mov    0x8(%rsp),%ebx
mov    0xc(%rsp),%r14d
lea    0x1(%r14),%eax
cmp    %eax,%ebx
jle    116d <main+0x3d>
lea    0xe9f(%rip),%rdi
call   1040 <puts@plt>
jmp    11e8 <main+0xb8>
jne    118d <main+0x5d>
nop
mov    $0x31,%edi
call   1030 <putchar@plt>
addl   $0xffffffff,0x8(%rsp)
je     11de <main+0xae>
mov    $0x30,%edi
call   1030 <putchar@plt>
jmp    1170 <main+0x40>
mov    %r14d,%ebp
sub    %ebx,%ebp
mov    %ebx,%eax
sub    $0x1,%eax
mov    %eax,0x8(%rsp)
jb     11bb <main+0x8b>
nopl   (%rax)
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    $0x31,%edi
call   1030 <putchar@plt>
subl   $0x1,0x8(%rsp)
jae    11a0 <main+0x70>
test   %ebp,%ebp
je     11de <main+0xae>
sub    %r14d,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x30,%edi
call   1030 <putchar@plt>
inc    %ebx
jne    11d0 <main+0xa0>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%d%d\00"
@.str.1 = [4 x i8] c"NO\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%6 = load i32, i32* %3
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 1
%9 = icmp sgt i32 %6, %8
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %48
12: ; preds = %0
%13 = load i32, i32* %3
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
%16 = icmp eq i32 %13, %15
br i1 %16, label %17, label %28
17: ; preds = %12
%18 = call i32 @putchar(i8 signext 49)
br label %19
19: ; preds = %23, %17
%20 = load i32, i32* %3
%21 = add nsw i32 %20, -1
store i32 %21, i32* %3
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = call i32 @putchar(i8 signext 48)
%25 = call i32 @putchar(i8 signext 49)
br label %19
26: ; preds = %19
%27 = call i32 @putchar(i8 signext 10)
store i32 0, i32* %1
br label %48
28: ; preds = %12
%29 = load i32, i32* %2
%30 = load i32, i32* %3
%31 = sub nsw i32 %29, %30
store i32 %31, i32* %4
br label %32
32: ; preds = %36, %28
%33 = load i32, i32* %3
%34 = add nsw i32 %33, -1
store i32 %34, i32* %3
%35 = icmp ne i32 %33, 0
br i1 %35, label %36, label %39
36: ; preds = %32
%37 = call i32 @putchar(i8 signext 48)
%38 = call i32 @putchar(i8 signext 49)
br label %32
39: ; preds = %32
br label %40
40: ; preds = %44, %39
%41 = load i32, i32* %4
%42 = add nsw i32 %41, -1
store i32 %42, i32* %4
%43 = icmp ne i32 %41, 0
br i1 %43, label %44, label %46
44: ; preds = %40
%45 = call i32 @putchar(i8 signext 48)
br label %40
46: ; preds = %40
%47 = call i32 @putchar(i8 signext 10)
store i32 0, i32* %1
br label %48
48: ; preds = %46, %26, %10
%49 = load i32, i32* %1
ret i32 %49
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d%d\00"
@str = [3 x i8] c"NO\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %2
%7 = load i32, i32* %1
%8 = add nsw i32 %7, 1
%9 = icmp sgt i32 %6, %8
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
br label %46
12: ; preds = %0
%13 = icmp eq i32 %6, %8
br i1 %13, label %14, label %27
14: ; preds = %12
%15 = call i32 @putchar(i8 signext 49)
%16 = load i32, i32* %2
%17 = add nsw i32 %16, -1
store i32 %17, i32* %2
%18 = icmp eq i32 %17, 0
br i1 %18, label %25, label %19
19: ; preds = %14, %19
%20 = call i32 @putchar(i8 signext 48)
%21 = call i32 @putchar(i8 signext 49)
%22 = load i32, i32* %2
%23 = add nsw i32 %22, -1
store i32 %23, i32* %2
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %19
25: ; preds = %19, %14
%26 = call i32 @putchar(i8 signext 10)
br label %46
27: ; preds = %12
%28 = sub nsw i32 %7, %6
%29 = add nsw i32 %6, -1
store i32 %29, i32* %2
%30 = icmp eq i32 %6, 0
br i1 %30, label %31, label %33
31: ; preds = %33, %27
%32 = icmp eq i32 %28, 0
br i1 %32, label %44, label %39
33: ; preds = %27, %33
%34 = call i32 @putchar(i8 signext 48)
%35 = call i32 @putchar(i8 signext 49)
%36 = load i32, i32* %2
%37 = add nsw i32 %36, -1
store i32 %37, i32* %2
%38 = icmp eq i32 %36, 0
br i1 %38, label %31, label %33
39: ; preds = %31, %39
%40 = phi i32 [ %41, %39 ], [ %28, %31 ]
%41 = add nsw i32 %40, -1
%42 = call i32 @putchar(i8 signext 48)
%43 = icmp eq i32 %41, 0
br i1 %43, label %44, label %39
44: ; preds = %39, %31
%45 = call i32 @putchar(i8 signext 10)
br label %46
46: ; preds = %44, %25, %10
ret i32 0
}