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