#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    x += k;
    v[i] = x;
  }
  sort(v.begin(), v.end());
  int ans = 0;
  for (int i = 0; i < n - 2; i += 3) {
    if (v[i] <= 5 && v[i + 1] <= 5 && v[i + 2] <= 5) ans++;
  }
  cout << ans;
}
