#include <bits/stdc++.h>
using namespace std;
struct knap {
  int cnt[3001], ps[3001];
};
int n, s, arr[3001];
knap st[3000 * 4 + 1];
void build(int id, int l, int r) {
  if (l == r) {
    st[id].cnt[arr[l]]++;
    for (int i = 1; i <= s; i++)
      st[id].ps[i] = st[id].ps[i - 1] + st[id].cnt[i];
    return;
  }
  int mid = l + (r - l) / 2;
  build(id * 2, l, mid);
  build(id * 2 + 1, mid + 1, r);
  for (int i = 1; i <= s; i++) {
    st[id].cnt[i] = st[id * 2].ps[i - 1] + st[id * 2 + 1].ps[i - 1] +
                    st[id * 2].cnt[i] + st[id * 2 + 1].cnt[i];
    if (s % 2 == 0)
      st[id].cnt[i] -= (st[id * 2].cnt[i / 2] + st[id * 2 + 1].cnt[i / 2]);
  }
  for (int i = 1; i <= s; i++) st[id].ps[i] = st[id].ps[i - 1] + st[id].cnt[i];
}
int main() {
  int n, s;
  cin >> n >> s;
  for (int i = 0; i < n; i++) cin >> arr[i];
  build(1, 0, n - 1);
  cout << st[1].ps[s] << endl;
}
