#include <bits/stdc++.h>
using namespace std;
int main() {
  long int n, k;
  cin >> n >> k;
  long int a, res = 0;
  for (int i = 0; i < n; i++) {
    cin >> a;
    if (a + k <= 5) res++;
  }
  cout << res / 3 << endl;
}
