Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	io := NewIo()
	defer io.Flush()
	for {
		n, m := io.NextInt(), io.NextInt()
		if n == 0 {
			break
		}
		a := make([]int, n)
		for i := 0; i < n; i++ {
			a[i] = io.NextInt()
		}
		ans := 0
		for i := 0; i < n; i++ {
			for j := i + 1; j < n; j++ {
				if a[i]+a[j] <= m {
					ans = intMax(a[i]+a[j], ans)
				}
			}
		}
		if ans == 0 {
			io.Println("NONE")
		} else {
			io.Println(ans)
		}
	}
}

func intMax(a, b int) int {
	if a < b {
		return b
	}
	return a
}

// I/O template
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buff []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buff = append(buff, line...)
		if !isPrefix {
			break
		}
	}
	return string(buff)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	s := io.tokens[io.nextToken]
	io.nextToken++
	return s
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntSlice(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func (io *Io) PrintStringSlice(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func Log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}

func ExampleIo() {
	io := NewIo()
	defer io.Flush()
	a := make([]int, 0, 3)
	a[0], a[1], a[2] = io.NextInt(), io.NextInt(), io.NextInt()
	io.Println(a)
	io.PrintIntSlice(a)
	Log("io", a)
}

Python: import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**13
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    def f(n,m):
        a = LI()
        r = None
        for i in range(n):
            for j in range(i+1,n):
                t = a[i] + a[j]
                if m >= t and (r is None or r < t):
                    r = t

        if r is None:
            return 'NONE'
        return r

    while 1:
        n,m = LI()
        if n == 0:
            break
        rr.append(f(n,m))

    return '\n'.join(map(str,rr))


print(main())

Python: import numpy as np
ans=[]
for i in range(50000):
    n,m=map(int,input().split())
    if n==0 and m==0:
        break
    else:
        A=list(map(int,input().split(' ')))
        sum=0
        max=0
        for j in range(len(A)):
            for k in range(len(A)):
                if j!=k:
                    sum=A[j]+A[k]
                    if sum>=max and sum<=m:
                        max=sum
        if max==0:
            max="NONE"
        ans.append(max)
for i in range(len(ans)):
    if ans[i]!=0:
        print(ans[i])
    else:
        break

Python: while True:

    items,money=list(map(int,input().split()))

    if money==0 and items==0:
        break

    prices=list(map(int,input().split()))

    times=int(items*(items-1)/2)

    sum_list=[]

    low=0
    high=1
    sum=0
    i = 0

    while True:
        #sum=prices[low]+prices[high]

        if high>items-1:
            low+=1
            high=low+1
        if low==items-1:
            break
        #print(high,low)
        sum = prices[low] + prices[high]
        #print(sum)
        if sum<=money:
            sum_list.append(sum)
            high+=1
            i+=1
        else:
            high+=1

    if i==0:
        print("NONE")
    else:
        print(max(sum_list))

Python: ans = []
cou = 0

while(1):
    n,m = map(int,input().split())
    if(n == 0): break
    ar = list(map(int,input().split()))
    max_ans = 0


    for i in range(n-1):
        for j in range(i,n):
            if(max_ans < ar[i]+ar[j] and ar[i]+ar[j] <= m):
                max_ans = ar[i] + ar[j]

    ans.append(max_ans)
    cou += 1

for i in range(cou):
    if(ans[i] == 0): print("NONE")
    else: print(ans[i])

Python: A=[0 for i in range(2)]
A=input().split()
n=int(A[0])
m=int(A[1])
max=[]
k=0
while n>0 and m>0:
    B=[0 for i in range(n)]
    B=input().split()
    for i in range(n):
        B[i]=int(B[i])
    ma=0
    for i in range(n-1):
        for j in range(i,n):   
            x=B[i]+B[j]
            if ma<x and x<=m:
                ma=x
    max.append(ma)
    A=input().split()
    n=int(A[0])
    m=int(A[1])
    k+=1
for i in range(k):
    if max[i]>0:
        print(max[i])
    else:
        print("NONE")

Python: # coding: utf-8
# Your code here!

while True:
   n, m = map(int, input().split())   # 品物の個数、許容額
   if n + m == 0: break

   price = list(map(int, input().split()))
   #print(price)
   
   sum = 0
   max = 0
   c = 0
   for i in range(n):
      for j in range(i + 1, n):
         sum = price[i] + price[j]
         if sum <= m and sum > max:
            max = sum
            
   if max == 0:
      print("NONE")
   else:
      print(max)

Python: while(1) :
    x = input().split()
    n = int(x[0])
    m = int(x[1])
    if (n == 0 and m == 0): break
    a = input().split()
    mx = -1
    for i in range(n-1):
        for j in range(i+1,n):
            tmp = int(a[i]) + int(a[j])
            if tmp > mx and tmp <= m: mx = tmp
    if mx == -1: print("NONE")
    else: print(mx)

Python: maxs=[]
while(True):
    max=0
    
    b=list(map(int,input().split()))
    n=b[0]
    m=b[1]
    if(n == 0 and m == 0):
        break
    a=list(map(int,input().split()))
    for i in range(n):
        for j in range(i+1,n):
            sum=a[i]+a[j]
            if(sum>max and sum<m):
                max=sum
    
    maxs.append(max)
for i in maxs:
    if maxs[i]==0:
        print("NONE")
    else:
        print(maxs[i])

Python: import sys
while(True):
    items=[]
    max=0
    n, m = map(int, input().split())
    if (n == 0 & m == 0):exit()
    items = list(map(int, input().split()))
    for i in range(n):
        for j in range(n):
            sum = items[i] + items[j]
            if (i != j and sum <= m and sum > max):
                max = sum
    if (max == 0):
        print("NONE")
    else:
        print(max)

Python: import sys
while(True):
    items=[]
    max=0
    n, m = map(int, input().split())
    if (n == 0 & m == 0):exit()
    items = list(map(int, input().split()))
    for i in range(n):
        for j in range(n):
            sum = items[i] + items[j]
            if (i != j and sum < m and sum > max):
                max = sum
    if (max == 0):
        print("NONE")
    else:
        print(max)