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