#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 1000000007;
const double EPS = 1e-10;
const double PI = 3.14159265359;
const int N = 100005;
int n, k;
int a[102];
int dp[102][N];
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  if (a[0] == k) dp[0][k] = 1;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j <= k; j++) {
      if (j == 0) {
        dp[i][j] = 1;
        continue;
      }
      dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % MOD;
    }
  }
  cout << dp[n - 1][k] << endl;
  return 0;
}
