#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int c1 = 0;
  int y;
  for (int i = 0; i < n; i++) {
    cin >> y;
    if (y <= (5 - m)) c1++;
  }
  cout << (c1 / 3) << endl;
  return 0;
}
