#include <bits/stdc++.h>
int const N = 100100;
int a[N];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  std::sort(a, a + n, [](int a, int b) { return a % 10 > b % 10; });
  for (int i = 0; i < n; ++i) {
    int need = std::min(100 - a[i], 10 - a[i] % 10);
    if (k >= need) {
      k -= need;
      a[i] += need;
    } else {
      break;
    }
  }
  for (int i = 0; i < n; ++i) {
    int add = std::min(k, 100 - a[i]);
    k -= add;
    a[i] += add;
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    ans += a[i] / 10;
  }
  printf("%d\n", ans);
}
