#include <bits/stdc++.h>
using namespace std;
int cnt[10];
int main() {
  int n, k;
  int full10 = 0;
  scanf("%d %d", &n, &k);
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    int cur;
    scanf("%d", &cur);
    ans += cur / 10;
    if (cur != 100) {
      full10 += 10 - (cur / 10);
      if (cur % 10) {
        --full10;
        ++cnt[10 - cur % 10];
      }
    }
  }
  for (int i = 1; i < 10 && k >= i; ++i) {
    int cur = min(cnt[i], k / i);
    ans += cur;
    k -= cur * i;
  }
  ans += min(full10, k / 10);
  printf("%d\n", ans);
}
