#include <iostream>
#include <algorithm>
using namespace std;

int main(){
  int n, S;
  int t[20002];

  while(cin >> n >> S, n || S){
    for(int i = 0; i < n; i++){
      cin >> t[i];
    }
    sort(t, t + n);

    int sum = 0;

    for(int i = 0; i < n; i++){
      int rem = S - t[i] + 1;
      int pos = max((int)(lower_bound(t, t + n, rem) - t), i + 1);

      sum += n - pos;
    }

    cout << sum << endl;
  }
}