#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, c;
  while (~scanf("%d %d", &n, &k)) {
    int ans = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d", &c);
      if (5 - c >= k) {
        ans++;
      }
    }
    printf("%d\n", ans / 3);
  }
  return 0;
}
