#include <bits/stdc++.h>
using namespace std;
int t, a[2001], i, cnt, res;
int main() {
  cin >> t >> i;
  for (int k = 1; k <= t; k++) {
    cin >> a[k];
  }
  sort(a + 1, a + t + 1);
  for (int k = 1; k <= t; k++) {
    if (a[k] + i <= 5) {
      cnt++;
    } else {
      break;
    }
    if (cnt == 3) {
      res++;
      cnt = 0;
    }
  }
  cout << res;
}
