#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main() {
  int n, k;
  while (cin >> n >> k) {
    for (int i = 0; i < n; i++) scanf("%d", &a[i]);
    int ans = 0;
    int m = 9;
    int flag = 0;
    while (k >= 10 - m && !flag) {
      for (m = 9; m >= 0 && k >= 10 - m; m--) {
        for (int i = 0; i < n && k >= (10 - m); i++) {
          if (a[i] == 100) continue;
          if (a[i] % 10 == m && a[i] < 100) {
            a[i] += (10 - m);
            k -= (10 - m);
          }
        }
      }
      for (int i = 0; i < n; i++) {
        if (a[i] != 100) break;
        if (i == n - 1) flag = 1;
      }
      m = 0;
    }
    for (int i = 0; i < n; i++) {
      ans += a[i] / 10;
    }
    cout << ans << endl;
  }
  return 0;
}
