func_code_string: #include <bits/stdc++.h>   using namespace std;   long long int arr[2005];   long long int dp[2005][2005];   long long int n, h;   long long int calc(long long int id, long long int prev) {     if (id == n + 1) {       return !prev;     }     long long int ans = dp[id][prev];     if (ans != -1) {       return ans;     }     long long int val = arr[id] + prev;     ans = 0;     if (val == h) {       ans = calc(id + 1, prev);       if (prev) {         ans = (ans + (prev * calc(id + 1, prev - 1)) % 1000000007) % 1000000007;       }     } else if (val == h - 1) {       ans = calc(id + 1, prev + 1);       ans = (ans + calc(id + 1, prev)) % 1000000007;       ans = (ans + (prev * calc(id + 1, prev)) % 1000000007) % 1000000007;     }     return (dp[id][prev] = ans);   }   int main() {     memset(dp, -1, sizeof(dp));     scanf( %lld , &n);     scanf( %lld , &h);     long long int i;     for (i = 1; i <= n; i++) {       scanf( %lld , &arr[i]);     }     long long int ans = calc(1, 0);     printf( %lld , ans);     ;     printf(  n );     return 0;   }   