#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100000 + 100;
bool cmp(int a, int b) {
  int pos_a = (a + 10) / 10 * 10;
  int pos_b = (b + 10) / 10 * 10;
  int dif_a = pos_a - a;
  int dif_b = pos_b - b;
  if (dif_a < dif_b) return 1;
  return 0;
}
int arr[MAX_N];
int n, k;
int solve() {
  int res = 0;
  for (int i = 0; i < n; i++) {
    res += arr[i] / 10;
  }
  return res;
}
int main() {
  memset(arr, 0, sizeof(arr));
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", &arr[i]);
  sort(arr, arr + n, cmp);
  int last_k = -1;
  while (last_k != k) {
    last_k = k;
    for (int i = 0; i < n; i++) {
      if (arr[i] >= 100) continue;
      if (k <= 0) break;
      int pos = ((arr[i] + 10) / 10) * 10;
      if (k - (pos - arr[i]) < 0)
        continue;
      else
        k = k - (pos - arr[i]);
      arr[i] = pos;
    }
    sort(arr, arr + n, cmp);
  }
  printf("%d\n", solve());
  return 0;
}
