#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, sum, req = 0, ans = 0, x, temp, temp1;
  scanf("%d%d", &n, &k);
  int arr[15] = {0};
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    arr[x % 10]++;
    req += (100 - x);
    ans += x / 10;
  }
  if (k >= req)
    ans = 10 * n;
  else {
    temp = k;
    while (temp > 0) {
      for (int i = 9; i >= 0; i--) {
        if (arr[i] > 0) {
          if ((10 - i) * arr[i] <= temp) {
            temp -= (10 - i) * arr[i];
            temp1 = arr[i];
            arr[0] += temp1;
            ans += temp1;
            arr[i] -= temp1;
          } else {
            ans += temp / (10 - i);
            temp = 0;
          }
        }
      }
    }
  }
  cout << ans << endl;
}
