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