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