#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;

int main(){
  int n,s;
  while(cin>>n>>s,n||s){
    vector<int> r(n);
    REP(i,n)cin>>r[i];
    sort(r.begin(), r.end());
    int ans = 0;
    REP(i,n){
      int t = s - r[i];
      vector<int>::iterator it = upper_bound(r.begin(), r.end(), t);
      ans += min(n-i-1, (int)distance(it, r.end()));
    }
    cout<<ans<<endl;
  }
      


  return 0;
}