#include <bits/stdc++.h>
using namespace std;
int n, k, a, t = 0;
int main(void) {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a;
    if (a <= 5 - k) t++;
  }
  cout << t / 3 << "\n";
  return 0;
}
