#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k, count = 0, in;
  cin >> n >> k;
  for (unsigned int i = 0; i < n; i++) {
    cin >> in;
    if (in + k <= 5) count++;
  }
  cout << count / 3 << endl;
  return 0;
}
