#include <bits/stdc++.h>
using namespace std;
int n, k;
int arr[100010];
bool cmp(int a, int b) { return a % 10 > b % 10; }
int main() {
  while (cin >> n >> k) {
    for (int i = 0; i < n; i++) cin >> arr[i];
    sort(arr, arr + n, cmp);
    for (int i = 0; i < n; i++) {
      int t = min(100, (arr[i] / 10 + 1) * 10) - arr[i];
      if (k >= t) {
        arr[i] += t;
        k -= t;
      } else
        break;
    }
    for (int i = 0; i < n; i++) {
      int t = min(k, 100 - arr[i]);
      arr[i] += t;
      k -= t;
      if (k == 0) break;
    }
    int ans = 0;
    for (int i = 0; i < n; i++) ans += arr[i] / 10;
    cout << ans << endl;
  }
  return 0;
}
