#include <bits/stdc++.h>
using namespace std;
int main() {
  int num;
  cin >> num;
  int k;
  cin >> k;
  int *arr = new int[num];
  int count = 0;
  for (int x = 0; x < num; x++) cin >> arr[x];
  for (int y = 0; y < num; y++) {
    if ((arr[y] + k) <= 5) count++;
  }
  cout << count / 3;
  return 0;
}
