#include <bits/stdc++.h>
using namespace std;
int main() {
  long long x, y, c = 0;
  cin >> x >> y;
  int *a = new int[x];
  for (int i = 0; i < x; i++) {
    cin >> a[i];
    if (a[i] + y <= 5) c++;
  }
  cout << c / 3;
  return 0;
}
