#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d, e, mx, mn = 1e9, mxi, mni, cnt, bnt;
string s, f, l;
bool ok = false;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> a >> b;
  for (int i = 0; i < a; ++i) {
    cin >> c;
    if (c + b <= 5) cnt++;
  }
  cout << cnt / 3 << "\n";
  cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
  return 0;
}
