#include <bits/stdc++.h>
using namespace std;
int a[100005], n, k;
bool cmp(int x, int y) { return x % 10 > y % 10; }
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n, cmp);
  for (int i = 0; i < n; i++) {
    if (a[i] % 10 == 0 || k < 10 - a[i] % 10) break;
    k -= 10 - a[i] % 10;
    a[i] += 10 - a[i] % 10;
  }
  for (int i = 0; i < n; i++) {
    if (k < 10) break;
    int cpy = a[i];
    a[i] = min(100, a[i] + k - k % 10);
    k -= (a[i] - cpy);
  }
  int ans = 0;
  for (int i = 0; i < n; i++) ans += a[i] / 10;
  cout << ans;
}
