#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char *calloc(long, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, long long);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, long *, ...);
int main() {
  FILE *f = fopen("quacau.inp", "r");
  long n, m, i;
  long long k, *ways;
  char *broken;
  fscanf(f, "%ld %ld %Ld", &n, &m, &k);
  broken = calloc(n + 1, sizeof(char));
  for (; k; k--) {
    fscanf(f, "%ld", &i);
    broken[i] = 1;
  }
  fclose(f);
  ways = (long long *)calloc(n + m + 1, sizeof(long long)) + m;
  *ways = 1;
  for (i = 0; i < n; i++) {
    k = (ways[i] + k - ways[i - m] + 1000000007) % 1000000007;
    if (!broken[i + 1])
      ways[i + 1] = k;
  }
  f = fopen("quacau.out", "w");
  fprintf(f, "%Ld\n", ways[n]);
  fclose(f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    0xe9e(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe8c(%rip),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x30(%rbp),%r8
mov    $0x0,%al
call   1040 <fscanf@plt>
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     11e8 <main+0x98>
mov    -0x10(%rbp),%rdi
lea    0xe59(%rip),%rsi
lea    -0x28(%rbp),%rdx
mov    $0x0,%al
call   1040 <fscanf@plt>
mov    -0x40(%rbp),%rax
mov    -0x28(%rbp),%rcx
movb   $0x1,(%rax,%rcx,1)
mov    -0x30(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
jmp    11aa <main+0x5a>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x18(%rbp),%rdi
add    -0x20(%rbp),%rdi
add    $0x1,%rdi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    -0x20(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movq   $0x1,(%rax)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    12a5 <main+0x155>
mov    -0x38(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
add    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    -0x28(%rbp),%rdx
sub    -0x20(%rbp),%rdx
sub    (%rcx,%rdx,8),%rax
add    $0x3b9aca07,%rax
mov    $0x3b9aca07,%ecx
cqto
idiv   %rcx
mov    %rdx,-0x30(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x28(%rbp),%rcx
cmpb   $0x0,0x1(%rax,%rcx,1)
jne    128f <main+0x13f>
mov    -0x30(%rbp),%rdx
mov    -0x38(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %rdx,0x8(%rax,%rcx,8)
jmp    1294 <main+0x144>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1229 <main+0xd9>
lea    0xd71(%rip),%rdi
lea    0xd75(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xd57(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xe9e(%rip),%rdi
lea    0xea2(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r14
lea    0xe95(%rip),%rsi
lea    0x10(%rsp),%rdx
lea    0x20(%rsp),%rcx
lea    0x8(%rsp),%r8
mov    %rax,%rdi
xor    %eax,%eax
call   1040 <fscanf@plt>
mov    0x10(%rsp),%rdi
add    $0x1,%rdi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,%rbx
cmpq   $0x0,0x8(%rsp)
je     11e1 <main+0x91>
lea    0xe63(%rip),%r15
lea    0x18(%rsp),%r12
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <fscanf@plt>
mov    0x18(%rsp),%rax
movb   $0x1,(%rbx,%rax,1)
addq   $0xffffffffffffffff,0x8(%rsp)
jne    11c0 <main+0x70>
mov    %r14,%rdi
call   1030 <fclose@plt>
mov    0x10(%rsp),%rax
mov    0x20(%rsp),%rcx
lea    (%rax,%rcx,1),%rdi
add    $0x1,%rdi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,%r10
mov    0x20(%rsp),%rax
lea    (%r10,%rax,8),%r14
movq   $0x1,(%r10,%rax,8)
mov    0x10(%rsp),%r8
movq   $0x0,0x18(%rsp)
test   %r8,%r8
jle    129c <main+0x14c>
mov    $0x1,%edi
movabs $0x89705f3112a28fe5,%r9
5f 70 89
mov    $0x1,%ecx
add    0x8(%rsp),%rcx
sub    -0x8(%r10,%rdi,8),%rcx
lea    0x3b9aca07(%rcx),%rsi
mov    %rsi,%rax
imul   %r9
lea    (%rdx,%rcx,1),%rax
add    $0x3b9aca07,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x1d,%rax
add    %rcx,%rax
imul   $0x3b9aca07,%rax,%rax
sub    %rax,%rsi
mov    %rsi,0x8(%rsp)
cmpb   $0x0,(%rbx,%rdi,1)
jne    1288 <main+0x138>
mov    %rsi,(%r14,%rdi,8)
mov    %rdi,0x18(%rsp)
cmp    %rdi,%r8
je     129c <main+0x14c>
mov    (%r14,%rdi,8),%rcx
add    $0x1,%rdi
jmp    1240 <main+0xf0>
lea    0xd7a(%rip),%rdi
lea    0xd7e(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
mov    0x10(%rsp),%rax
mov    (%r14,%rax,8),%rdx
lea    0xd68(%rip),%rsi
mov    %rbx,%rdi
call   1060 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"quacau.inp\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [12 x i8] c"%ld %ld %Ld\00"
@.str.3 = [4 x i8] c"%ld\00"
@.str.4 = [11 x i8] c"quacau.out\00"
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [5 x i8] c"%Ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64*
%8 = alloca i8*
store i32 0, i32* %1
%9 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %9, i32** %2
%10 = load i32*, i32** %2
%11 = call i32 (i32*, i8*, i64*, ...) @fscanf(i32* %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i64* %3, i64* %4, i64* %6)
%12 = load i64, i64* %3
%13 = add nsw i64 %12, 1
%14 = call i8* @calloc(i64 %13, i32 1)
store i8* %14, i8** %8
br label %15
15: ; preds = %24, %0
%16 = load i64, i64* %6
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %27
18: ; preds = %15
%19 = load i32*, i32** %2
%20 = call i32 (i32*, i8*, i64*, ...) @fscanf(i32* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i64* %5)
%21 = load i8*, i8** %8
%22 = load i64, i64* %5
%23 = getelementptr inbounds i8, i8* %21, i64 %22
store i8 1, i8* %23
br label %24
24: ; preds = %18
%25 = load i64, i64* %6
%26 = add nsw i64 %25, -1
store i64 %26, i64* %6
br label %15
27: ; preds = %15
%28 = load i32*, i32** %2
%29 = call i32 @fclose(i32* %28)
%30 = load i64, i64* %3
%31 = load i64, i64* %4
%32 = add nsw i64 %30, %31
%33 = add nsw i64 %32, 1
%34 = call i8* @calloc(i64 %33, i32 8)
%35 = bitcast i8* %34 to i64*
%36 = load i64, i64* %4
%37 = getelementptr inbounds i64, i64* %35, i64 %36
store i64* %37, i64** %7
%38 = load i64*, i64** %7
store i64 1, i64* %38
store i64 0, i64* %5
br label %39
39: ; preds = %72, %27
%40 = load i64, i64* %5
%41 = load i64, i64* %3
%42 = icmp slt i64 %40, %41
br i1 %42, label %43, label %75
43: ; preds = %39
%44 = load i64*, i64** %7
%45 = load i64, i64* %5
%46 = getelementptr inbounds i64, i64* %44, i64 %45
%47 = load i64, i64* %46
%48 = load i64, i64* %6
%49 = add nsw i64 %47, %48
%50 = load i64*, i64** %7
%51 = load i64, i64* %5
%52 = load i64, i64* %4
%53 = sub nsw i64 %51, %52
%54 = getelementptr inbounds i64, i64* %50, i64 %53
%55 = load i64, i64* %54
%56 = sub nsw i64 %49, %55
%57 = add nsw i64 %56, 1000000007
%58 = srem i64 %57, 1000000007
store i64 %58, i64* %6
%59 = load i8*, i8** %8
%60 = load i64, i64* %5
%61 = add nsw i64 %60, 1
%62 = getelementptr inbounds i8, i8* %59, i64 %61
%63 = load i8, i8* %62
%64 = icmp ne i8 %63, 0
br i1 %64, label %71, label %65
65: ; preds = %43
%66 = load i64, i64* %6
%67 = load i64*, i64** %7
%68 = load i64, i64* %5
%69 = add nsw i64 %68, 1
%70 = getelementptr inbounds i64, i64* %67, i64 %69
store i64 %66, i64* %70
br label %71
71: ; preds = %65, %43
br label %72
72: ; preds = %71
%73 = load i64, i64* %5
%74 = add nsw i64 %73, 1
store i64 %74, i64* %5
br label %39
75: ; preds = %39
%76 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %76, i32** %2
%77 = load i32*, i32** %2
%78 = load i64*, i64** %7
%79 = load i64, i64* %3
%80 = getelementptr inbounds i64, i64* %78, i64 %79
%81 = load i64, i64* %80
%82 = call i32 @fprintf(i32* %77, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i64 %81)
%83 = load i32*, i32** %2
%84 = call i32 @fclose(i32* %83)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"quacau.inp\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [12 x i8] c"%ld %ld %Ld\00"
@.str.3 = [4 x i8] c"%ld\00"
@.str.4 = [11 x i8] c"quacau.out\00"
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [5 x i8] c"%Ld\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = bitcast i64* %1 to i8*
%7 = bitcast i64* %2 to i8*
%8 = bitcast i64* %3 to i8*
%9 = bitcast i64* %4 to i8*
%10 = call i32 (i32*, i8*, i64*, ...) @fscanf(i32* %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i64* %1, i64* %2, i64* %4)
%11 = load i64, i64* %1
%12 = add nsw i64 %11, 1
%13 = call i8* @calloc(i64 %12, i32 1)
%14 = load i64, i64* %4
%15 = icmp eq i64 %14, 0
br i1 %15, label %23, label %16
16: ; preds = %0, %16
%17 = call i32 (i32*, i8*, i64*, ...) @fscanf(i32* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i64* %3)
%18 = load i64, i64* %3
%19 = getelementptr inbounds i8, i8* %13, i64 %18
store i8 1, i8* %19
%20 = load i64, i64* %4
%21 = add nsw i64 %20, -1
store i64 %21, i64* %4
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %16
23: ; preds = %16, %0
%24 = call i32 @fclose(i32* %5)
%25 = load i64, i64* %1
%26 = load i64, i64* %2
%27 = add i64 %25, 1
%28 = add i64 %27, %26
%29 = call i8* @calloc(i64 %28, i32 8)
%30 = bitcast i8* %29 to i64*
%31 = load i64, i64* %2
%32 = getelementptr inbounds i64, i64* %30, i64 %31
store i64 1, i64* %32
%33 = load i64, i64* %1
store i64 0, i64* %3
%34 = icmp sgt i64 %33, 0
br i1 %34, label %35, label %56
35: ; preds = %23, %53
%36 = phi i64 [ %55, %53 ], [ 1, %23 ]
%37 = phi i64 [ %45, %53 ], [ 0, %23 ]
%38 = load i64, i64* %4
%39 = getelementptr inbounds i64, i64* %30, i64 %37
%40 = load i64, i64* %39
%41 = add i64 %36, 1000000007
%42 = add i64 %41, %38
%43 = sub i64 %42, %40
%44 = srem i64 %43, 1000000007
store i64 %44, i64* %4
%45 = add nuw nsw i64 %37, 1
%46 = getelementptr inbounds i8, i8* %13, i64 %45
%47 = load i8, i8* %46
%48 = icmp eq i8 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %35
%50 = getelementptr inbounds i64, i64* %32, i64 %45
store i64 %44, i64* %50
br label %51
51: ; preds = %35, %49
store i64 %45, i64* %3
%52 = icmp eq i64 %45, %33
br i1 %52, label %56, label %53
53: ; preds = %51
%54 = getelementptr inbounds i64, i64* %32, i64 %45
%55 = load i64, i64* %54
br label %35
56: ; preds = %51, %23
%57 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%58 = load i64, i64* %1
%59 = getelementptr inbounds i64, i64* %32, i64 %58
%60 = load i64, i64* %59
%61 = call i32 @fprintf(i32* %57, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i64 %60)
%62 = call i32 @fclose(i32* %57)
ret i32 0
}