#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> ar;
  int temp;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    ar.push_back(temp);
  }
  int dp[k + 1][n + 1];
  for (int i = 0; i <= k; i++) dp[i][0] = 1;
  for (int i = 0; i <= k; i++) {
    for (int j = 1; j <= n; j++) {
      dp[i][j] = (i > 0) ? dp[i - 1][j] : 0;
      if (ar[j - 1] >= i) dp[i][j] += dp[i][j - 1];
    }
  }
  if (k)
    cout << dp[k][n] - dp[k - 1][n];
  else
    cout << 0 << endl;
}
