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