#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, sum = 0, count = 0, c = 0;
  cin >> n >> k;
  vector<int> v(n), e;
  for (int i = 0; i < (int)(n); ++i) cin >> v[i];
  for (int i = 0; i < ((int)((v).size())); ++i)
    if (v[i] + k <= 5) c++;
  cout << c / 3 << endl;
  return 0;
}
