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